Skip to content

Add tests for backup#588

Open
sjha4 wants to merge 3 commits into
theforeman:masterfrom
sjha4:backup_tests
Open

Add tests for backup#588
sjha4 wants to merge 3 commits into
theforeman:masterfrom
sjha4:backup_tests

Conversation

@sjha4

@sjha4 sjha4 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Why are you introducing these changes? (Problem description, related links)

Add tests for foremanctl backup

What are the changes introduced in this pull request?

  • Add tests for foremanctl backup

How to test this pull request

The CI should run the new tests.
Steps to reproduce:

  • Check CI

Checklist

  • Tests added/updated (if applicable)
  • Documentation updated (if applicable)

PS: I had some issues with the OBSAH_STATE_PATH running these locally in a repo checkout. The backup is supposed to work on a host with services deployed and with path as /var/lib/foremanctl. The repo setup is different from production-like installs where the quadlet is mapped to localhost. On dev setup, quadlet is actual VM so the test finds OBSAH_STATE_PATH as /.var/lib/foremanctl inside the VM. Hence the conditional test for foremanctl state archive which archives this path.

@sjha4 sjha4 force-pushed the backup_tests branch 5 times, most recently from 95d6d11 to 727cdd8 Compare June 23, 2026 05:55
Comment thread src/roles/backup/tasks/main.yaml
@sjha4 sjha4 force-pushed the backup_tests branch 2 times, most recently from 359bea6 to 736e9d2 Compare June 24, 2026 20:03
Comment thread tests/backup_test.py Outdated
Comment thread tests/backup_test.py Outdated
Comment thread tests/backup_test.py
Comment thread tests/backup_test.py
Comment thread tests/backup_test.py
Comment thread tests/backup_test.py Outdated
Comment thread tests/backup_test.py Outdated
"""
Test that foremanctl state directory is archived.

NOTE: This test is conditional because foremanctl-state.tar.gz is only

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test should not be conditional, that tells me there is a design flaw that should be fixed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated backup to handle localhost and quadlet based deployments. Have kept it as a separate commit to isolate the change there..

Comment thread tests/backup_test.py Outdated
Comment thread tests/backup_test.py Outdated
Comment thread tests/backup_test.py Outdated
Comment thread tests/backup_test.py Outdated
Comment thread tests/backup_test.py Outdated
Comment thread tests/backup_test.py Outdated
Comment thread tests/backup_test.py Outdated
@sjha4 sjha4 force-pushed the backup_tests branch 3 times, most recently from 574985c to 7a0eb4c Compare June 30, 2026 16:33
Comment thread src/roles/backup/tasks/main.yaml Outdated
@sjha4 sjha4 force-pushed the backup_tests branch 4 times, most recently from 96d9ed4 to af5224e Compare July 6, 2026 20:07
@sjha4

sjha4 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@ehelms Greenery.. 🥗

Comment thread src/playbooks/backup/metadata.obsah.yaml Outdated
become: false
register: backup_temp_dir

- name: Archive foremanctl state on controller

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you do this within the obsah_state_path?

  1. generate archive inside obsah_state_path
  2. transfer to target location

Then no temporary directory or cleanup is needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to archive /var/lib/foremanctl/ directory on target into the backup directory on target..No cleanup/temp files../var/lib/foremanctl works on localhost, quadlet and proxy where the obsah_state_path will be mounted.. 👍🏼

@sjha4 sjha4 force-pushed the backup_tests branch 2 times, most recently from b2063ea to b627a88 Compare July 9, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants